<!DOCTYPE html>
<html lang="zh-CN">
<head>
  <meta charset="UTF-8">
<meta name="viewport" content="width=device-width">
<meta name="theme-color" content="#222"><meta name="generator" content="Hexo 7.3.0">

  <link rel="apple-touch-icon" sizes="180x180" href="/images/apple-touch-icon-next.png">
  <link rel="icon" type="image/png" sizes="32x32" href="/images/favicon-32x32.ico">
  <link rel="icon" type="image/png" sizes="16x16" href="/images/favicon-16x16.ico">
  <link rel="mask-icon" href="/images/logo.svg" color="#222">

<link rel="stylesheet" href="/css/main.css">



<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.1/css/all.min.css" integrity="sha256-wiz7ZSCn/btzhjKDQBms9Hx4sSeUYsDrTLg7roPstac=" crossorigin="anonymous">
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/animate.css/3.1.1/animate.min.css" integrity="sha256-PR7ttpcvz8qrF57fur/yAx1qXMFJeJFiA6pSzWi0OIE=" crossorigin="anonymous">
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/fancyapps-ui/5.0.28/fancybox/fancybox.css" integrity="sha256-6cQIC71/iBIYXFK+0RHAvwmjwWzkWd+r7v/BX3/vZDc=" crossorigin="anonymous">
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/pace/1.2.4/themes/green/pace-theme-minimal.css">
  <script src="https://cdnjs.cloudflare.com/ajax/libs/pace/1.2.4/pace.min.js" integrity="sha256-gqd7YTjg/BtfqWSwsJOvndl0Bxc8gFImLEkXQT8+qj0=" crossorigin="anonymous"></script>

<script class="next-config" data-name="main" type="application/json">{"hostname":"sumumm.github.io","root":"/","images":"/images","scheme":"Gemini","darkmode":false,"version":"8.19.2","exturl":false,"sidebar":{"position":"left","display":"post","padding":18,"offset":12},"copycode":{"enable":true,"style":"mac"},"fold":{"enable":true,"height":300},"bookmark":{"enable":false,"color":"#222","save":"auto"},"mediumzoom":false,"lazyload":true,"pangu":false,"comments":{"style":"tabs","active":null,"storage":true,"lazyload":false,"nav":null},"stickytabs":false,"motion":{"enable":true,"async":true,"transition":{"menu_item":"fadeInDown","post_block":"fadeIn","post_header":"fadeInDown","post_body":"fadeInDown","coll_header":"fadeInLeft","sidebar":"fadeInUp"}},"i18n":{"placeholder":"搜索...","empty":"没有找到任何搜索结果：${query}","hits_time":"找到 ${hits} 个搜索结果（用时 ${time} 毫秒）","hits":"找到 ${hits} 个搜索结果"},"path":"/search.xml","localsearch":{"enable":true,"trigger":"auto","top_n_per_article":1,"unescape":false,"preload":false}}</script><script src="/js/config.js"></script>

    <meta name="description" content="本文主要是输入类设备控制——触摸屏设备的相关笔记，若笔记中有错误或者不合适的地方，欢迎批评指正😃。">
<meta property="og:type" content="article">
<meta property="og:title" content="LV17-01-输入类设备-03-触摸屏设备">
<meta property="og:url" content="https://sumumm.github.io/post/b62103be.html">
<meta property="og:site_name" content="苏木">
<meta property="og:description" content="本文主要是输入类设备控制——触摸屏设备的相关笔记，若笔记中有错误或者不合适的地方，欢迎批评指正😃。">
<meta property="og:locale" content="zh_CN">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV03-%E5%BA%94%E7%94%A8%E5%BC%80%E5%8F%91/LV17-01-%E8%BE%93%E5%85%A5%E7%B1%BB%E8%AE%BE%E5%A4%87-03-%E8%A7%A6%E6%91%B8%E5%B1%8F%E8%AE%BE%E5%A4%87/img/image-20241020104122919.png">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV03-%E5%BA%94%E7%94%A8%E5%BC%80%E5%8F%91/LV17-01-%E8%BE%93%E5%85%A5%E7%B1%BB%E8%AE%BE%E5%A4%87-03-%E8%A7%A6%E6%91%B8%E5%B1%8F%E8%AE%BE%E5%A4%87/img/image-20241020104245057.png">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV03-%E5%BA%94%E7%94%A8%E5%BC%80%E5%8F%91/LV17-01-%E8%BE%93%E5%85%A5%E7%B1%BB%E8%AE%BE%E5%A4%87-03-%E8%A7%A6%E6%91%B8%E5%B1%8F%E8%AE%BE%E5%A4%87/img/image-20241020105117414.png">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV03-%E5%BA%94%E7%94%A8%E5%BC%80%E5%8F%91/LV17-01-%E8%BE%93%E5%85%A5%E7%B1%BB%E8%AE%BE%E5%A4%87-03-%E8%A7%A6%E6%91%B8%E5%B1%8F%E8%AE%BE%E5%A4%87/img/image-20241020105855877.png">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV03-%E5%BA%94%E7%94%A8%E5%BC%80%E5%8F%91/LV17-01-%E8%BE%93%E5%85%A5%E7%B1%BB%E8%AE%BE%E5%A4%87-03-%E8%A7%A6%E6%91%B8%E5%B1%8F%E8%AE%BE%E5%A4%87/img/image-20241020105920047.png">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV03-%E5%BA%94%E7%94%A8%E5%BC%80%E5%8F%91/LV17-01-%E8%BE%93%E5%85%A5%E7%B1%BB%E8%AE%BE%E5%A4%87-03-%E8%A7%A6%E6%91%B8%E5%B1%8F%E8%AE%BE%E5%A4%87/img/image-20240922091236961.png">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV03-%E5%BA%94%E7%94%A8%E5%BC%80%E5%8F%91/LV17-01-%E8%BE%93%E5%85%A5%E7%B1%BB%E8%AE%BE%E5%A4%87-03-%E8%A7%A6%E6%91%B8%E5%B1%8F%E8%AE%BE%E5%A4%87/img/image-20240922101009736.png">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV03-%E5%BA%94%E7%94%A8%E5%BC%80%E5%8F%91/LV17-01-%E8%BE%93%E5%85%A5%E7%B1%BB%E8%AE%BE%E5%A4%87-03-%E8%A7%A6%E6%91%B8%E5%B1%8F%E8%AE%BE%E5%A4%87/img/1726971289291.png">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV03-%E5%BA%94%E7%94%A8%E5%BC%80%E5%8F%91/LV17-01-%E8%BE%93%E5%85%A5%E7%B1%BB%E8%AE%BE%E5%A4%87-03-%E8%A7%A6%E6%91%B8%E5%B1%8F%E8%AE%BE%E5%A4%87/img/image-20240922094313045.png">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV03-%E5%BA%94%E7%94%A8%E5%BC%80%E5%8F%91/LV17-01-%E8%BE%93%E5%85%A5%E7%B1%BB%E8%AE%BE%E5%A4%87-03-%E8%A7%A6%E6%91%B8%E5%B1%8F%E8%AE%BE%E5%A4%87/img/image-20240922102341563.png">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV03-%E5%BA%94%E7%94%A8%E5%BC%80%E5%8F%91/LV17-01-%E8%BE%93%E5%85%A5%E7%B1%BB%E8%AE%BE%E5%A4%87-03-%E8%A7%A6%E6%91%B8%E5%B1%8F%E8%AE%BE%E5%A4%87/img/image-20240922102435847.png">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV03-%E5%BA%94%E7%94%A8%E5%BC%80%E5%8F%91/LV17-01-%E8%BE%93%E5%85%A5%E7%B1%BB%E8%AE%BE%E5%A4%87-03-%E8%A7%A6%E6%91%B8%E5%B1%8F%E8%AE%BE%E5%A4%87/img/image-20240922103226855.png">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV03-%E5%BA%94%E7%94%A8%E5%BC%80%E5%8F%91/LV17-01-%E8%BE%93%E5%85%A5%E7%B1%BB%E8%AE%BE%E5%A4%87-03-%E8%A7%A6%E6%91%B8%E5%B1%8F%E8%AE%BE%E5%A4%87/img/image-20240922103702265.png">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV03-%E5%BA%94%E7%94%A8%E5%BC%80%E5%8F%91/LV17-01-%E8%BE%93%E5%85%A5%E7%B1%BB%E8%AE%BE%E5%A4%87-03-%E8%A7%A6%E6%91%B8%E5%B1%8F%E8%AE%BE%E5%A4%87/img/image-20240922094313045.png">
<meta property="article:published_time" content="2024-10-27T11:29:19.000Z">
<meta property="article:modified_time" content="2025-06-13T16:25:57.035Z">
<meta property="article:author" content="苏木">
<meta property="article:tag" content="(ALPHA)LV03-应用开发">
<meta name="twitter:card" content="summary">
<meta name="twitter:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV03-%E5%BA%94%E7%94%A8%E5%BC%80%E5%8F%91/LV17-01-%E8%BE%93%E5%85%A5%E7%B1%BB%E8%AE%BE%E5%A4%87-03-%E8%A7%A6%E6%91%B8%E5%B1%8F%E8%AE%BE%E5%A4%87/img/image-20241020104122919.png">


<link rel="canonical" href="https://sumumm.github.io/post/b62103be.html">



<script class="next-config" data-name="page" type="application/json">{"sidebar":"","isHome":false,"isPost":true,"lang":"zh-CN","comments":"","permalink":"https://sumumm.github.io/post/b62103be.html","path":"post/b62103be.html","title":"LV17-01-输入类设备-03-触摸屏设备"}</script>

<script class="next-config" data-name="calendar" type="application/json">""</script>
<title>LV17-01-输入类设备-03-触摸屏设备 | 苏木</title>
  








    <script src="/js/browser_tools_disable.js"></script>

  <noscript>
    <link rel="stylesheet" href="/css/noscript.css">
  </noscript>
<!-- hexo injector head_end start --><link rel="stylesheet" href="https://unpkg.com/hexo-next-tags-plus@latest/lib/tag_plus.css" media="defer" onload="this.media='all'"><!-- hexo injector head_end end --></head>

<body itemscope itemtype="http://schema.org/WebPage" class="use-motion">
  <div class="headband"></div>

  <main class="main">
    <div class="column">
      <header class="header" itemscope itemtype="http://schema.org/WPHeader"><div class="site-brand-container">
  <div class="site-nav-toggle">
    <div class="toggle" aria-label="切换导航栏" role="button">
        <span class="toggle-line"></span>
        <span class="toggle-line"></span>
        <span class="toggle-line"></span>
    </div>
  </div>

  <div class="site-meta">

    <a href="/" class="brand" rel="start">
      <i class="logo-line"></i>
      <p class="site-title">苏木</p>
      <i class="logo-line"></i>
    </a>
      <p class="site-subtitle" itemprop="description">我的学习之路</p>
  </div>

  <div class="site-nav-right">
    <div class="toggle popup-trigger" aria-label="搜索" role="button">
        <i class="fa fa-search fa-fw fa-lg"></i>
    </div>
  </div>
</div>



<nav class="site-nav">
  <ul class="main-menu menu"><li class="menu-item menu-item-home"><a href="/" rel="section"><i class="fa fa-home fa-fw"></i>苏木的家</a></li><li class="menu-item menu-item-categories"><a href="/categories/" rel="section"><i class="fa fa-th fa-fw"></i>分类页<span class="badge">42</span></a></li><li class="menu-item menu-item-archives"><a href="/archives/" rel="section"><i class="fa fa-archive fa-fw"></i>归档页<span class="badge">673</span></a></li><li class="menu-item menu-item-flink"><a href="/flink/" rel="section"><i class="fa fa-link fa-fw"></i>友人帐</a></li><li class="menu-item menu-item-about"><a href="/about/" rel="section"><i class="fa fa-user fa-fw"></i>关于我</a></li>
      <li class="menu-item menu-item-search">
        <a role="button" class="popup-trigger"><i class="fa fa-search fa-fw"></i>搜索
        </a>
      </li>
  </ul>
</nav>



  <div class="search-pop-overlay">
    <div class="popup search-popup"><div class="search-header">
  <span class="search-icon">
    <i class="fa fa-search"></i>
  </span>
  <div class="search-input-container">
    <input autocomplete="off" autocapitalize="off" maxlength="80"
           placeholder="搜索..." spellcheck="false"
           type="search" class="search-input">
  </div>
  <span class="popup-btn-close" role="button">
    <i class="fa fa-times-circle"></i>
  </span>
</div>
<div class="search-result-container no-result">
  <div class="search-result-icon">
    <i class="fa fa-spinner fa-pulse fa-5x"></i>
  </div>
</div>

    </div>
  </div>

</header>
        
  
  <aside class="sidebar">

    <div class="sidebar-inner sidebar-nav-active sidebar-toc-active">
      <ul class="sidebar-nav">
        <li class="sidebar-nav-toc">
          文章目录
        </li>
        <li class="sidebar-nav-overview">
          站点概览
        </li>
      </ul>

      <div class="sidebar-panel-container">
        <!--noindex-->
        <div class="post-toc-wrap sidebar-panel">
            <div class="post-toc animated"><ol class="nav"><li class="nav-item nav-level-1"><a class="nav-link" href="#%E4%B8%80%E3%80%81%E7%94%B5%E9%98%BB%E5%B1%8F%E5%92%8C%E7%94%B5%E5%AE%B9%E5%B1%8F"><span class="nav-text">一、电阻屏和电容屏</span></a><ol class="nav-child"><li class="nav-item nav-level-2"><a class="nav-link" href="#1-%E7%94%B5%E9%98%BB%E5%B1%8F"><span class="nav-text">1. 电阻屏  </span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#1-1-%E6%AC%A7%E5%A7%86%E5%AE%9A%E5%BE%8B"><span class="nav-text">1.1 欧姆定律</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#1-2-%E7%94%B5%E9%98%BB%E5%B1%8F%E5%9F%BA%E6%9C%AC%E5%8E%9F%E7%90%86"><span class="nav-text">1.2 电阻屏基本原理</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#1-3-%E7%94%B5%E9%98%BB%E5%B1%8F%E6%95%B0%E6%8D%AE"><span class="nav-text">1.3 电阻屏数据  </span></a></li></ol></li><li class="nav-item nav-level-2"><a class="nav-link" href="#2-%E7%94%B5%E5%AE%B9%E5%B1%8F"><span class="nav-text">2. 电容屏</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#2-1-%E5%9F%BA%E6%9C%AC%E5%8E%9F%E7%90%86"><span class="nav-text">2.1 基本原理</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#2-2-%E7%94%B5%E5%AE%B9%E5%B1%8F%E6%95%B0%E6%8D%AE"><span class="nav-text">2.2 电容屏数据  </span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#2-3-%E7%94%B5%E5%AE%B9%E5%B1%8F%E7%9A%84%E5%AE%9E%E9%AA%8C%E6%95%B0%E6%8D%AE"><span class="nav-text">2.3 电容屏的实验数据  </span></a></li></ol></li></ol></li><li class="nav-item nav-level-1"><a class="nav-link" href="#%E4%BA%8C%E3%80%81%E7%BB%9D%E5%AF%B9%E4%BD%8D%E7%A7%BB%E4%BA%8B%E4%BB%B6"><span class="nav-text">二、绝对位移事件</span></a></li><li class="nav-item nav-level-1"><a class="nav-link" href="#%E4%B8%89%E3%80%81%E5%8D%95%E7%82%B9%E8%A7%A6%E6%91%B8%E5%92%8C%E5%A4%9A%E7%82%B9%E8%A7%A6%E6%91%B8"><span class="nav-text">三、单点触摸和多点触摸</span></a><ol class="nav-child"><li class="nav-item nav-level-2"><a class="nav-link" href="#1-%E4%B8%A4%E4%B8%AA%E6%A6%82%E5%BF%B5"><span class="nav-text">1. 两个概念</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#2-%E4%BA%8B%E4%BB%B6%E4%B8%8A%E6%8A%A5%E7%9A%84%E9%A1%BA%E5%BA%8F"><span class="nav-text">2.事件上报的顺序  </span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#2-1-%E5%8D%95%E7%82%B9%E8%A7%A6%E6%91%B8%E8%AE%BE%E5%A4%87"><span class="nav-text">2.1  单点触摸设备</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#2-2-%E5%A4%9A%E7%82%B9%E8%A7%A6%E6%91%B8%E8%AE%BE%E5%A4%87"><span class="nav-text">2.2 多点触摸设备</span></a></li></ol></li><li class="nav-item nav-level-2"><a class="nav-link" href="#3-%E8%A7%A6%E6%91%B8%E5%B1%8F%E4%B8%8A%E6%8A%A5%E6%95%B0%E6%8D%AE%E5%88%86%E6%9E%90"><span class="nav-text">3. 触摸屏上报数据分析  </span></a></li></ol></li><li class="nav-item nav-level-1"><a class="nav-link" href="#%E5%9B%9B%E3%80%81%E8%8E%B7%E5%8F%96%E8%A7%A6%E6%91%B8%E5%B1%8F%E4%BF%A1%E6%81%AF"><span class="nav-text">四、获取触摸屏信息</span></a><ol class="nav-child"><li class="nav-item nav-level-2"><a class="nav-link" href="#1-%E5%87%BD%E6%95%B0%E7%AE%80%E4%BB%8B"><span class="nav-text">1. 函数简介</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#2-%E5%A6%82%E4%BD%95%E4%BD%BF%E7%94%A8%EF%BC%9F"><span class="nav-text">2. 如何使用？</span></a></li></ol></li><li class="nav-item nav-level-1"><a class="nav-link" href="#%E4%BA%94%E3%80%81%E6%9F%A5%E7%9C%8B%E8%A7%A6%E6%91%B8%E5%B1%8F%E8%8A%82%E7%82%B9"><span class="nav-text">五、查看触摸屏节点</span></a></li></ol></div>
        </div>
        <!--/noindex-->

        <div class="site-overview-wrap sidebar-panel">
          <div class="site-author animated" itemprop="author" itemscope itemtype="http://schema.org/Person">
    <img class="site-author-image" itemprop="image" alt="苏木"
      src="/images/avatar.jpg">
  <p class="site-author-name" itemprop="name">苏木</p>
  <div class="site-description" itemprop="description">莫道桑榆晚，为霞尚满天</div>
</div>
<div class="site-state-wrap animated">
  <nav class="site-state">
      <div class="site-state-item site-state-posts">
        <a href="/archives/">
          <span class="site-state-item-count">673</span>
          <span class="site-state-item-name">日志</span>
        </a>
      </div>
      <div class="site-state-item site-state-categories">
          <a href="/categories/">
        <span class="site-state-item-count">42</span>
        <span class="site-state-item-name">分类</span></a>
      </div>
      <div class="site-state-item site-state-tags">
        <span class="site-state-item-count">43</span>
        <span class="site-state-item-name">标签</span>
      </div>
  </nav>
</div>
  <div class="links-of-author animated">
      <span class="links-of-author-item">
        <a href="https://github.com/sumumm" title="GitHub → https:&#x2F;&#x2F;github.com&#x2F;sumumm" rel="noopener me" target="_blank"><i class="fab fa-github fa-fw"></i>GitHub</a>
      </span>
  </div>

        </div>
      </div>
    </div>

    
  </aside>


    </div>

    <div class="main-inner post posts-expand">


  


<div class="post-block">
  
  

  <article itemscope itemtype="http://schema.org/Article" class="post-content" lang="zh-CN">
    <link itemprop="mainEntityOfPage" href="https://sumumm.github.io/post/b62103be.html">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="image" content="/images/avatar.jpg">
      <meta itemprop="name" content="苏木">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="苏木">
      <meta itemprop="description" content="莫道桑榆晚，为霞尚满天">
    </span>

    <span hidden itemprop="post" itemscope itemtype="http://schema.org/CreativeWork">
      <meta itemprop="name" content="LV17-01-输入类设备-03-触摸屏设备 | 苏木">
      <meta itemprop="description" content="">
    </span>
      <header class="post-header">
        <h1 class="post-title" itemprop="name headline">
          LV17-01-输入类设备-03-触摸屏设备
        </h1>

        <div class="post-meta-container">
          <div class="post-meta">
    <span class="post-meta-item">
      <span class="post-meta-item-icon">
        <i class="far fa-calendar"></i>
      </span>
      <span class="post-meta-item-text">发表于</span>

      <time title="创建时间：2024-10-27 19:29:19" itemprop="dateCreated datePublished" datetime="2024-10-27T19:29:19+08:00">2024-10-27</time>
    </span>
    <span class="post-meta-item">
      <span class="post-meta-item-icon">
        <i class="far fa-folder"></i>
      </span>
      <span class="post-meta-item-text">分类于</span>
        <span itemprop="about" itemscope itemtype="http://schema.org/Thing">
          <a href="/categories/%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/" itemprop="url" rel="index"><span itemprop="name">嵌入式开发</span></a>
        </span>
          ，
        <span itemprop="about" itemscope itemtype="http://schema.org/Thing">
          <a href="/categories/%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/" itemprop="url" rel="index"><span itemprop="name">02IMX6ULL平台</span></a>
        </span>
          ，
        <span itemprop="about" itemscope itemtype="http://schema.org/Thing">
          <a href="/categories/%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV03-%E5%BA%94%E7%94%A8%E5%BC%80%E5%8F%91/" itemprop="url" rel="index"><span itemprop="name">LV03-应用开发</span></a>
        </span>
    </span>

  
    <span class="post-meta-break"></span>
    <span class="post-meta-item" title="本文字数">
      <span class="post-meta-item-icon">
        <i class="far fa-file-word"></i>
      </span>
      <span class="post-meta-item-text">本文字数：</span>
      <span>8.2k</span>
    </span>
    <span class="post-meta-item" title="阅读时长">
      <span class="post-meta-item-icon">
        <i class="far fa-clock"></i>
      </span>
      <span class="post-meta-item-text">阅读时长 &asymp;</span>
      <span>30 分钟</span>
    </span>
</div>

        </div>
      </header>

    
    
    
    <div class="post-body" itemprop="articleBody"><p>本文主要是输入类设备控制——触摸屏设备的相关笔记，若笔记中有错误或者不合适的地方，欢迎批评指正😃。</p>
<span id="more"></span>

<!-- Photo: https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV03-%E5%BA%94%E7%94%A8%E5%BC%80%E5%8F%91/LV17-01-%E8%BE%93%E5%85%A5%E7%B1%BB%E8%AE%BE%E5%A4%87-03-%E8%A7%A6%E6%91%B8%E5%B1%8F%E8%AE%BE%E5%A4%87/img/ -->

<details class="folding-tag" blue><summary> 点击查看使用工具及版本 </summary>
              <div class='content'>
              <table>    <tr>        <td align="center" rowspan="5">PC端开发环境</td>        <td align="center" width=150px>Windows</td>        <td align="left">Windows11</td>    </tr>    <tr>        <td align="center">Ubuntu</td>        <td align="left">Ubuntu20.04.2的64位版本</td>      </tr>    <tr>        <td align="center">VMware® Workstation 17 Pro</td>        <td align="left">17.6.0 build-24238078</td>      </tr>    <tr>        <td align="center">终端软件</td>        <td align="left">MobaXterm(Professional Edition v23.0 Build 5042 (license))</td>    </tr>    <tr>        <td align="center">Win32DiskImager</td>        <td align="left">Win32DiskImager v1.0</td>      </tr>    <tr>        <td align="center" rowspan="3">Linux开发板环境</td>        <td align="center">Linux开发板</td>        <td align="left">正点原子 i.MX6ULL Linux 阿尔法开发板</td>      </tr>    <tr>        <td align="center">uboot</td>        <td align="left">NXP官方提供的uboot，NXP提供的版本为uboot-imx-rel_imx_4.1.15_2.1.0_ga(使用的uboot版本为U-Boot 2016.03)</td>      </tr>    <tr>        <td align="center">linux内核</td>        <td align="left">linux-4.15(NXP官方提供)</td>      </tr></table>
              </div>
            </details>

<details class="folding-tag" blue><summary> 点击查看本文参考资料 </summary>
              <div class='content'>
              <table>    <tr>        <td align="center">分类</td>        <td align="center">网址</td>        <td align="center">说明</td>    </tr>    <tr>        <td align="center" rowspan="5">官方网站</td>        <td align="left"><a href="https://www.arm.com/" target="_blank">https://www.arm.com/</a></td>        <td align="left">ARM官方网站，在这里我们可以找到Cotex-Mx以及ARMVx的一些文档</td>    </tr>    <tr>        <td align="left"><a href="https://www.nxp.com.cn/" target="_blank">https://www.nxp.com.cn/ </a></td>        <td align="left">NXP官方网站</td>    </tr>    <tr>        <td align="left"><a href="https://www.nxpic.org.cn/" target="_blank">https://www.nxpic.org.cn/</a></td><td align="left">NXP 官方社区</td>    </tr>    <tr>        <td align="left"><a href="https://u-boot.readthedocs.io/en/latest/" target="_blank">https://u-boot.readthedocs.io/en/latest/</a></td><td align="left">u-boot官网</td>    </tr>    <tr>        <td align="left"><a href="https://www.kernel.org/" target="_blank">https://www.kernel.org/</a></td><td align="left">linux内核官网</td>    </tr>    <tr>        <td align="center" rowspan="5">其他网站</td>        <td align="left"><a href="https://elixir.bootlin.com/linux/v4.15/source/kernel" target="_blank">kernel - Linux source code (v4.15) - Bootlin</a></td>        <td align="left">linux内核源码在线查看</td>    </tr></table>
              </div>
            </details>

<details class="folding-tag" blue><summary> 点击查看相关文件下载 </summary>
              <div class='content'>
              <table>    <tr>        <td align="center">分类</td>        <td align="center">网址</td>        <td align="center">说明</td>    </tr>    <tr>        <td align="center" rowspan="4">NXP</td>        <td align="left"><a href="https://github.com/nxp-imx" target="_blank">https://github.com/nxp-imx</a></td>        <td align="left">NXP imx开发资源GitHub组织，里边会有u-boot和linux内核的仓库</td>    </tr>    <tr>        <td align="left"><a href="https://elixir.bootlin.com/linux/latest/source" target="_blank">https://elixir.bootlin.com/linux/latest/source</a></td>        <td align="left">在线阅读linux kernel源码</td>    </tr>    <tr>        <td align="left"><a href="https://github.com/nxp-imx/linux-imx/releases/tag/rel_imx_4.1.15_2.1.0_ga" target="_blank">nxp-imx/linux-imx/releases/tag/rel_imx_4.1.15_2.1.0_ga</a></td>        <td align="left">NXP linux内核仓库tags中的rel_imx_4.1.15_2.1.0_ga</td>    </tr>    <tr>        <td align="left"><a href="https://github.com/nxp-imx/uboot-imx/releases/tag/rel_imx_4.1.15_2.1.0_ga" target="_blank">nxp-imx/uboot-imx/releases/tag/rel_imx_4.1.15_2.1.0_ga</a></td>        <td align="left">NXP u-boot仓库tags中的rel_imx_4.1.15_2.1.0_ga</td>    </tr>    <tr>        <td align="center" rowspan="2">I.MX6ULL</td>        <td align="left"><a href="https://www.nxp.com.cn/docs/en/data-sheet/IMX6ULLIEC.pdf" target="_blank">i.MX 6ULL Applications Processors for Industrial Products</a></td>        <td align="left">I.MX6ULL 芯片手册（datasheet，可以在线查看）</td>    </tr>    <tr>        <td align="left"><a href="https://www.nxp.com.cn/webapp/Download?colCode=IMX6ULLRM&lang_cd=zh" target="_blank">i.MX 6ULL Applications ProcessorReference Manual</a></td>        <td align="left">I.MX6ULL 参考手册（下载后才能查看，需要登录NXP官网）</td>    </tr></table>
              </div>
            </details>

<h1 id="一、电阻屏和电容屏"><a href="#一、电阻屏和电容屏" class="headerlink" title="一、电阻屏和电容屏"></a><font size=3>一、电阻屏和电容屏</font></h1><p>触摸屏分为电阻屏、电容屏。电阻屏结构简单，在以前很流行；电容屏支持多点触摸，现在的手机基本都是使用电容屏。</p>
<p>注意： LCD、触摸屏不是一回事， LCD 是输出设备，触摸屏是输入设备。制作触摸屏时特意把它的尺寸做得跟 LCD 一模一样，并且把触摸屏覆盖在 LCD 上。  </p>
<h2 id="1-电阻屏"><a href="#1-电阻屏" class="headerlink" title="1. 电阻屏  "></a><font size=3>1. 电阻屏  </font></h2><h3 id="1-1-欧姆定律"><a href="#1-1-欧姆定律" class="headerlink" title="1.1 欧姆定律"></a><font size=3>1.1 欧姆定律</font></h3><img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV03-%E5%BA%94%E7%94%A8%E5%BC%80%E5%8F%91/LV17-01-%E8%BE%93%E5%85%A5%E7%B1%BB%E8%AE%BE%E5%A4%87-03-%E8%A7%A6%E6%91%B8%E5%B1%8F%E8%AE%BE%E5%A4%87/img/image-20241020104122919.png" alt="image-20241020104122919" style="zoom:50%;" />

<p>就是长度和阻值成正比关系。电阻长度为L，阻值为 R，在两端施加 3.3V 电压。在某点测得电阻为 V，求上图中长度 X。根据欧姆定律： 3.3&#x2F;R &#x3D; V&#x2F;Rx，因为长度和阻值成正比关系，上述公式转换为： 3.3∕L &#x3D; V&#x2F;X，所以 X&#x3D;LV&#x2F;3.3。  </p>
<h3 id="1-2-电阻屏基本原理"><a href="#1-2-电阻屏基本原理" class="headerlink" title="1.2 电阻屏基本原理"></a><font size=3>1.2 电阻屏基本原理</font></h3><p>电阻屏就是基于欧姆定律制作的，它有上下两层薄膜，这两层薄膜就是两个电阻，如下图所示：  </p>
<img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV03-%E5%BA%94%E7%94%A8%E5%BC%80%E5%8F%91/LV17-01-%E8%BE%93%E5%85%A5%E7%B1%BB%E8%AE%BE%E5%A4%87-03-%E8%A7%A6%E6%91%B8%E5%B1%8F%E8%AE%BE%E5%A4%87/img/image-20241020104245057.png" alt="image-20241020104245057" style="zoom:50%;" />

<p>平时上下两层薄膜无接触，当点击触摸屏时，上下两层薄膜接触：这时就可以测量触点电压。过程如下  </p>
<p>（1）测量 X 坐标  </p>
<p>在 xp、 xm 两端施加 3.3V 电压， yp 和 ym 不施加电压(yp 就相当于探针)，测量 yp 电压值。该电压值就跟 X 坐标成正比关系，假设： </p>
<figure class="highlight c"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">X = <span class="number">3.3</span>*Vyp/Xmax</span><br></pre></td></tr></table></figure>

<p> （2）测量 Y 坐标</p>
<p>yp、 ym 两端施加 3.3V 电压， xp 和 xm 不施加电压(xp 就相当于探针)，测量 xp 电压值。该电压值就跟 Y 坐标成正比关系，假设：</p>
<figure class="highlight c"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">Y = <span class="number">3.3</span>*Vxp/Ymax</span><br></pre></td></tr></table></figure>

<p>在实际使用时，电阻屏的 Xmax、 Ymax 无从得知，所以使用之前要先较准：依次点击触摸屏的四个角和中心点，推算出 X、 Y 坐标的公式：  </p>
<figure class="highlight c"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">X = func(Vyp)</span><br><span class="line">Y = func(Vxp)</span><br></pre></td></tr></table></figure>

<h3 id="1-3-电阻屏数据"><a href="#1-3-电阻屏数据" class="headerlink" title="1.3 电阻屏数据  "></a><font size=3>1.3 电阻屏数据  </font></h3><p>Linux 驱动程序中，会上报触点的 X、 Y 数据，注意：这不是 LCD 的坐标值，需要 APP 再次处理才能转换为 LCD 坐标值。  对应的 input_event 结构体中，“ type、 code、 value”如下：  </p>
<ul>
<li>按下时</li>
</ul>
<figure class="highlight c"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line">EV_KEY  BTN_TOUCH    <span class="number">1</span>           <span class="comment">/* 按下 */</span></span><br><span class="line">EV_ABS  ABS_PRESSURE <span class="number">1</span>           <span class="comment">/* 压力值，可以上报，也可以不报，可以是其他压力值 */</span></span><br><span class="line">EV_ABS  ABS_X        x_value     <span class="comment">/* X 坐标 */</span></span><br><span class="line">EV_ABS  ABS_Y        y_value     <span class="comment">/* Y 坐标 */</span></span><br><span class="line">EV_SYNC <span class="number">0</span>            <span class="number">0</span>           <span class="comment">/* 同步事件 */</span></span><br></pre></td></tr></table></figure>

<ul>
<li>松开时</li>
</ul>
<figure class="highlight c"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">EV_KEY  BTN_TOUCH    <span class="number">0</span> <span class="comment">/* 松开 */</span></span><br><span class="line">EV_ABS  ABS_PRESSURE <span class="number">0</span> <span class="comment">/* 压力值，可以上报，也可以不报 */</span></span><br><span class="line">EV_SYNC <span class="number">0</span>            <span class="number">0</span> <span class="comment">/* 同步事件 */</span></span><br></pre></td></tr></table></figure>

<h2 id="2-电容屏"><a href="#2-电容屏" class="headerlink" title="2. 电容屏"></a><font size=3>2. 电容屏</font></h2><h3 id="2-1-基本原理"><a href="#2-1-基本原理" class="headerlink" title="2.1 基本原理"></a><font size=3>2.1 基本原理</font></h3><img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV03-%E5%BA%94%E7%94%A8%E5%BC%80%E5%8F%91/LV17-01-%E8%BE%93%E5%85%A5%E7%B1%BB%E8%AE%BE%E5%A4%87-03-%E8%A7%A6%E6%91%B8%E5%B1%8F%E8%AE%BE%E5%A4%87/img/image-20241020105117414.png" alt="image-20241020105117414" style="zoom:50%;" />

<p>电容屏中有一个控制芯片，它会周期性产生驱动信号，接收电极接收到信号，并可测量电荷大小。当电容屏被按下时，相当于引入了新的电容，从而影响了接收电极接收到的电荷大小。主控芯片根据电荷大小即可计算出触点位置。  </p>
<p>怎么通过电荷计算出触点位置？这由控制芯片实现，这类芯片一般是 I2C 接口。我们只需要编写程序，通过 I2C 读取芯片寄存器即可得到这些数据。  </p>
<h3 id="2-2-电容屏数据"><a href="#2-2-电容屏数据" class="headerlink" title="2.2 电容屏数据  "></a><font size=3>2.2 电容屏数据  </font></h3><p>参考文档：Linux内核源码中的 <a target="_blank" rel="noopener" href="https://elixir.bootlin.com/linux/v4.15/source/Documentation/input/multi-touch-protocol.rst">multi-touch-protocol.rst - Documentation&#x2F;input&#x2F;multi-touch-protocol.rst - Linux source code v4.15 - Bootlin</a>。  </p>
<p>电容屏可以支持多点触摸(Multi touch)，驱动程序上报的数据中怎么分辨触点？  这有两种方法： Type A、 Type B，这也对应两种类型的触摸屏：  </p>
<ul>
<li><p>Type A：该类型的触摸屏不能分辨是哪一个触点，它只是把所有触点的坐标一股脑地上报，由软件来分辨这些数据分别属于哪一个触点。Type A 已经过时， Linux 内核中都没有 Type A 的源码了。</p>
</li>
<li><p>Type B：该类型的触摸屏能分辨是哪一个触点，上报数据时会先上报触点 ID，再上报它的数据。</p>
</li>
</ul>
<p>我们来看一个最简单的示例，从使用场景分析来看看它上报的数据。当有 2 个触点时(type, code, value)：  </p>
<figure class="highlight c"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br></pre></td><td class="code"><pre><span class="line">EV_ABS ABS_MT_SLOT        <span class="number">0</span>    <span class="comment">// 这表示“我要上报一个触点信息了”，用来分隔触点信息</span></span><br><span class="line">EV_ABS ABS_MT_TRACKING_ID <span class="number">45</span>   <span class="comment">// 这个触点的 ID 是 45</span></span><br><span class="line">EV_ABS ABS_MT_POSITION_X  x[<span class="number">0</span>] <span class="comment">// 触点 X 坐标</span></span><br><span class="line">EV_ABS ABS_MT_POSITION_Y  y[<span class="number">0</span>] <span class="comment">// 触点 Y 坐标</span></span><br><span class="line">EV_ABS ABS_MT_SLOT        <span class="number">1</span>    <span class="comment">// 这表示“我要上报一个触点信息了”，用来分隔触点信息</span></span><br><span class="line">EV_ABS ABS_MT_TRACKING_ID <span class="number">46</span>   <span class="comment">// 这个触点的 ID 是 46</span></span><br><span class="line">EV_ABS ABS_MT_POSITION_X  x[<span class="number">1</span>] <span class="comment">// 触点 X 坐标</span></span><br><span class="line">EV_ABS ABS_MT_POSITION_Y  y[<span class="number">1</span>] <span class="comment">// 触点 Y 坐标</span></span><br><span class="line">EV_SYNC SYN_REPORT        <span class="number">0</span>    <span class="comment">// 全部数据上报完毕</span></span><br></pre></td></tr></table></figure>

<p>当 ID 为 45 的触点正在移动时：  </p>
<figure class="highlight c"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">EV_ABS ABS_MT_SLOT        <span class="number">0</span>    <span class="comment">// 这表示“我要上报一个触点信息了”，之前上报过 ID，就不用再上报 ID了</span></span><br><span class="line">EV_ABS ABS_MT_POSITION_X  x[<span class="number">0</span>] <span class="comment">// 触点 X 坐标</span></span><br><span class="line">EV_SYNC SYN_REPORT        <span class="number">0</span>    <span class="comment">// 全部数据上报完毕</span></span><br></pre></td></tr></table></figure>

<p>松开 ID 为 45 的触点时(在前面 slot 已经被设置为 0，这里这需要再重新设置slot， slot 就像一个全局变量一样：如果它没变化的话，就无需再次设置)：  </p>
<figure class="highlight c"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">// 刚刚设置了 ABS_MT_SLOT 为 0，它对应 ID 为 45，这里设置 ID 为-1 就表示 ID 为 45 的触点被松开了</span></span><br><span class="line">EV_ABS ABS_MT_TRACKING_ID <span class="number">-1</span></span><br><span class="line">EV_SYNC SYN_REPORT         <span class="number">0</span>   <span class="comment">// 全部数据上报完毕</span></span><br></pre></td></tr></table></figure>

<p>最后，松开 ID 为 46 的触点：  </p>
<figure class="highlight c"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">EV_ABS ABS_MT_SLOT         <span class="number">1</span> <span class="comment">// 这表示“我要上报一个触点信息了”，在前面设置过 slot 1 的 ID为 46</span></span><br><span class="line">EV_ABS ABS_MT_TRACKING_ID <span class="number">-1</span> <span class="comment">// ID 为-1，表示 slot 1 被松开，即 ID 为 46 的触点被松开</span></span><br><span class="line">EV_SYNC SYN_REPORT           <span class="comment">// 全部数据上报完毕</span></span><br></pre></td></tr></table></figure>

<h3 id="2-3-电容屏的实验数据"><a href="#2-3-电容屏的实验数据" class="headerlink" title="2.3 电容屏的实验数据  "></a><font size=3>2.3 电容屏的实验数据  </font></h3><p>假设开发板上电容屏对应的设备节点是&#x2F;dev&#x2F;input&#x2F;event0，执行以下命令：  </p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">hexdump /dev/input/event0</span><br></pre></td></tr></table></figure>

<p>然后用一个手指点击触摸屏，得到类似下图的数据</p>
<img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV03-%E5%BA%94%E7%94%A8%E5%BC%80%E5%8F%91/LV17-01-%E8%BE%93%E5%85%A5%E7%B1%BB%E8%AE%BE%E5%A4%87-03-%E8%A7%A6%E6%91%B8%E5%B1%8F%E8%AE%BE%E5%A4%87/img/image-20241020105855877.png" alt="image-20241020105855877" />

<p>在上面的数据中，为了兼容老程序，它也上报了 ABS_X、 ABS_Y 数据，电阻触摸屏就是使用这类型的数据。所以基于电阻屏的程序，也可以用在电容屏上。使用两个手指点击触摸屏时，得到类似如下的数据：  </p>
<img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV03-%E5%BA%94%E7%94%A8%E5%BC%80%E5%8F%91/LV17-01-%E8%BE%93%E5%85%A5%E7%B1%BB%E8%AE%BE%E5%A4%87-03-%E8%A7%A6%E6%91%B8%E5%B1%8F%E8%AE%BE%E5%A4%87/img/image-20241020105920047.png" alt="image-20241020105920047" style="zoom: 67%;" />

<p>为了兼容老程序，它也上报了 ABS_X、 ABS_Y 数据，但是只上报第 1 个触点的数据。  </p>
<h1 id="二、绝对位移事件"><a href="#二、绝对位移事件" class="headerlink" title="二、绝对位移事件"></a><font size=3>二、绝对位移事件</font></h1><p>触摸屏设备是一个绝对位移设备，可以上报绝对位移事件，绝对位移事件如下（<a target="_blank" rel="noopener" href="https://elixir.bootlin.com/linux/v4.15/source/include/uapi/linux/input-event-codes.h#L714">input-event-codes.h - include&#x2F;uapi&#x2F;linux&#x2F;input-event-codes.h - Linux source code v4.15 - Bootlin</a>）：  </p>
<img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV03-%E5%BA%94%E7%94%A8%E5%BC%80%E5%8F%91/LV17-01-%E8%BE%93%E5%85%A5%E7%B1%BB%E8%AE%BE%E5%A4%87-03-%E8%A7%A6%E6%91%B8%E5%B1%8F%E8%AE%BE%E5%A4%87/img/image-20240922091236961.png" alt="image-20240922091236961" />

<h1 id="三、单点触摸和多点触摸"><a href="#三、单点触摸和多点触摸" class="headerlink" title="三、单点触摸和多点触摸"></a><font size=3>三、单点触摸和多点触摸</font></h1><h2 id="1-两个概念"><a href="#1-两个概念" class="headerlink" title="1. 两个概念"></a><font size=3>1. 两个概念</font></h2><p>触摸屏分为多点触摸设备和单点触摸设备。 单点触摸设备只支持单点触摸， 一轮（这里把一个同步事件称为一轮） 完整的数据只包含一个触摸点信息； 单点触摸设备以 ABS_XXX 事件承载、上报触摸点的信息，如 ABS_X（value 值对应的是 X 轴坐标值）、 ABS_Y（value 值对应的是 Y 轴坐标值）等绝对位移事件，而有些设备可能还支持 Z 轴坐标（通过 ABS_Z 事件上报、 value 值对应的便是 Z 轴坐标值）、 按压力大小（通过 ABS_PRESSURE 事件上报、 value 值对应的便是按压力大小） 以及接触面积等属性。 大部分的单点触摸设备都会上报 ABS_X 和 ABS_Y 事件，而其它绝对位移事件则根据具体的设备以及驱动的实现而定。</p>
<p>多点触摸设备可支持多点触摸，如 ALPHA 开发板配套使用的 4.3 寸、 7 寸等触摸屏均支持多点触摸，对于多点触摸设备， 一轮完整的数据可能包含多个触摸点信息。 多点触摸设备则是以 ABS_MT_XXX（MT 是 Multi-touch， 意思为： 多点触摸）事件承载、上报触摸点的信息， 如 ABS_MT_POSITION_X（X 轴坐标） 、 ABS_MT_POSITION_Y（Y 轴坐标）等绝对位移事件。  </p>
<p>触摸屏设备除了上报绝对位移事件之外，还可以上报按键类事件和同步类事件。同步事件很好理解，因为几乎每一个输入设备都会上报同步事件、告知应用层本轮数据是否完整；当手指点击触摸屏或手指从触摸屏离开时，此时就会上报按键类事件， 用于描述按下触摸屏和松开触摸屏； 具体的按键事件为BTN_TOUCH（code&#x3D;0x14a，也就是 330） ，当然，手指在触摸屏上滑动不会上报 BTN_TOUCH 事件。  </p>
<blockquote>
<p>TN_TOUCH 事件不支持长按状态，故其 value 不会等于 2。 对于多点触摸设备来说，只有第一个点按下时上报 BTN_TOUCH 事件 value&#x3D;1、当最后一个点离开触摸屏时上报 BTN_TOUCH 事件 value&#x3D;0。  </p>
</blockquote>
<h2 id="2-事件上报的顺序"><a href="#2-事件上报的顺序" class="headerlink" title="2.事件上报的顺序  "></a><font size=3>2.事件上报的顺序  </font></h2><h3 id="2-1-单点触摸设备"><a href="#2-1-单点触摸设备" class="headerlink" title="2.1  单点触摸设备"></a><font size=3>2.1  单点触摸设备</font></h3><p>通过上面的了解可知，单点触摸设备事件上报的流程大概如下：  </p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta prompt_"># </span><span class="language-bash">点击触摸屏时</span></span><br><span class="line">BTN_TOUCH</span><br><span class="line">ABS_X</span><br><span class="line">ABS_Y</span><br><span class="line">SYN_REPORT</span><br><span class="line"><span class="meta prompt_"></span></span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">滑动</span></span><br><span class="line">ABS_X</span><br><span class="line">ABS_Y</span><br><span class="line">SYN_REPORT</span><br><span class="line"><span class="meta prompt_"></span></span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">松开</span></span><br><span class="line">BTN_TOUCH</span><br><span class="line">SYN_REPORT</span><br></pre></td></tr></table></figure>

<p>以上列举出只是一个大致流程，实际上对于不同的触摸屏设备，能够获取到的信息量大小是不相同的，如某设备只能读取到触摸点的 X 和 Y 坐标、而另一设备却能读取 X、 Y 坐标以及按压力大小、 触点面积等信息， 总之这些数据都会在 SYN_REPORT 同步事件之前上报给应用层。  </p>
<p>当手指点击触摸屏时，首先上报 BTN_TOUCH 事件，此时 value&#x3D;1，表示按下；接着上报 ABS_X、 ABS_Y事件将 X、 Y 轴坐标数据发送给应用层；数据上报完成接着上报一个同步事件 SYN_REPORT，表示此次触摸点信息已经完整。 </p>
<p>当手指在触摸屏上滑动时，并不会上报 BTN_TOUCH 事件，因为滑动过程并未发生按下、松开这种动作。  </p>
<p>当松开时，首先上报了 BTN_TOUCH 事件，此时 value&#x3D;0，表示手指已经松开了触摸屏，接着上报一个同步事件 SYN_REPORT。  </p>
<h3 id="2-2-多点触摸设备"><a href="#2-2-多点触摸设备" class="headerlink" title="2.2 多点触摸设备"></a><font size=3>2.2 多点触摸设备</font></h3><p>多点触摸设备上报的一轮完整数据中可能包含多个触摸点的信息，如 5 点触摸设备，如果 5 个手指同时在触摸屏上滑动，那么硬件就会更新 5 个触摸点的信息， 内核需要把这 5 个触摸点的信息上报给应用层。  </p>
<p>在 Linux 内核中， 多点触摸设备使用多点触摸（MT）协议上报各个触摸点的数据， MT 协议分为两种类型： Type A 和 Type B， Type A 协议实际使用中用的比较少，几乎处于淘汰的边缘， 这里就暂时不去了解了，我们重点来看看 Type B 协议。  </p>
<ul>
<li><strong>MT 协议之 Type B 协议</strong></li>
</ul>
<p>Type B 协议适用于能够追踪并区分触摸点的设备，开发板配套使用的触摸屏都属于这类设备。 Type B协议的重点是通过 ABS_MT_SLOT 事件上报各个触摸点信息的更新。</p>
<p>能够追踪并区分触摸点的设备通常在硬件上能够区分不同的触摸点， 例如对于一个 5 点触摸设备来说，硬件能够为每一个识别到的触摸点与一个 slot 进行关联，这个 slot 就是一个编号， 触摸点 0、触摸点 1、触摸点 2 等。底层驱动向应用层上报 ABS_MT_SLOT 事件， 此事件会告诉接收者当前正在更新的是哪个触摸点的数据， ABS_MT_SLOT 事件中对应的 value 数据存放的便是一个 slot、以告知应用层当前正在更新 slot关联的触摸点对应的信息。  </p>
<p>每个识别出来的触摸点分配一个 slot， 与该 slot 关联起来， 利用这个 slot 来传递对应触点的变化。 除了ABS_MT_SLOT 事件之外，Type B 协议还会使用到 ABS_MT_TRACTKING_ID 事 件 ，ABS_MT_TRACTKING_ID 事件则用于触摸点的创建、替换和销毁工作，ABS_MT_TRACTKING_ID 事件携带的数据 value 表示一个 ID，一个非负数的 ID（ID&gt;&#x3D;0） 表示一个有效的触摸点，如果 ID 等于-1 表示该触摸点已经不存在、被移除了；一个以前不存在的 ID 表示这是一个新的触摸点。  </p>
<p>Type B 协议可以减少发送到用户空间的数据，只有发生了变更的数据才会上报，如某个触摸点发生了移动，但仅仅只改变了 X 轴坐标、而未改变 Y 轴坐标，那么内核只会将改变后的 X 坐标值通过ABS_MT_POSITION_X 事件发送给应用层。  </p>
<p>Type B 协议下多点触摸设备上报数据的流程大致如下：</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br></pre></td><td class="code"><pre><span class="line">ABS_MT_SLOT 0</span><br><span class="line">ABS_MT_TRACKING_ID 10</span><br><span class="line">ABS_MT_POSITION_X</span><br><span class="line">ABS_MT_POSITION_Y</span><br><span class="line">ABS_MT_SLOT 1</span><br><span class="line">ABS_MT_TRACKING_ID 11</span><br><span class="line">ABS_MT_POSITION_X</span><br><span class="line">ABS_MT_POSITION_Y</span><br><span class="line">SYN_REPORT</span><br></pre></td></tr></table></figure>

<p>这里看完应该还是不会很明白，可以在下一节的笔记中根据现象来分析。</p>
<blockquote>
<p>Tips：</p>
<p>slot 和 ID 这两个概念好像有些混乱，这里再简单解释一下：</p>
<p>slot 是硬件上的一个概念、而 ID 则可认为是软件上的一个概念；对于一个多点触摸设备来说，它最大支持的触摸点数是确定的，如 5 点触摸设备，最多支持 5 个触摸点；每一个触摸点在硬件上它有一个区分的编号，如触摸点0、触摸点 1、触摸点 2 等，这个编号就是一个 slot（通常从 0 开始） ； 如何给识别到的触点分配一个 slot 呢（触点与 slot 关联）？通常是按照时间先后顺序来的，如第一根手指先触碰到触摸屏，那第一根手指就对应触摸点 0（slot&#x3D;0），接着第二根手指触碰到触摸屏则对应触摸点 1（slot&#x3D;1）以此类推。这个通常是<strong>硬件所支持</strong>的。    </p>
<p>而 ID 可认为是软件上的一个概念，它也用于区分不同的触摸点，但是它跟 slot 不同， 不是同一层级的概念；举个例子，如一根手指触碰到触摸屏之后拿开，然后再次触碰触摸屏，这个过程中，假设只有这一根手指进行触碰操作，那么两次触碰对应都是触摸点 0（slot&#x3D;0），这个无疑义。但从触摸点的生命周期来看， 它们是同一个触摸点吗？答案肯定不是，为啥？手指从触摸屏上离开后，该触摸点就消失了、被删除了， 该触摸点的生命周期也就到此结束了，所以它们自然是不同的触摸点， 所以它们的 ID 是不同的。  </p>
</blockquote>
<h2 id="3-触摸屏上报数据分析"><a href="#3-触摸屏上报数据分析" class="headerlink" title="3. 触摸屏上报数据分析  "></a><font size=3>3. 触摸屏上报数据分析  </font></h2><p>首先在测试触摸屏之前，需要保证开发板上已经连接了 LCD 屏， ALPHA I.MX6U 开发板出厂系统配套支持多种不同分辨率的 LCD 屏，包括 4.3 寸 480*272、 4.3 寸 800*480、 7 寸 800*480、 7 寸 1024*600以及 10.1 寸 1280*800，在启动开发板之前需要将 LCD 屏通过软排线连接到开发板的 LCD 接口，开发板连接好 LCD 屏之后上电启动开发板、运行出厂系统。  </p>
<img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV03-%E5%BA%94%E7%94%A8%E5%BC%80%E5%8F%91/LV17-01-%E8%BE%93%E5%85%A5%E7%B1%BB%E8%AE%BE%E5%A4%87-03-%E8%A7%A6%E6%91%B8%E5%B1%8F%E8%AE%BE%E5%A4%87/img/image-20240922101009736.png" alt="image-20240922101009736" style="zoom:50%;" />

<p>不过我用的没上图那么大，我用的实4.3寸800*480那个。触摸屏与 LCD 液晶屏面板是粘合在一起的，也就是说触摸屏是直接贴在了 LCD 液晶屏上面，直接在LCD 屏上触摸、滑动操作即可。为了测试方便，可以将出厂系统的 GUI 应用程序退出，如何退出呢？点击屏幕进入设置页面，可以看到在该页面下有一个退出按钮选项，直接点击即可。退出后如下所示：</p>
<img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV03-%E5%BA%94%E7%94%A8%E5%BC%80%E5%8F%91/LV17-01-%E8%BE%93%E5%85%A5%E7%B1%BB%E8%AE%BE%E5%A4%87-03-%E8%A7%A6%E6%91%B8%E5%B1%8F%E8%AE%BE%E5%A4%87/img/1726971289291.png" alt="1726971289291" style="zoom: 39%;" />

<p>那触摸屏输入的时候是哪个事件节点？我们还是通过以下命令来查看：</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">cat /proc/bus/input/devices</span><br></pre></td></tr></table></figure>

<p>可以看到如下打印信息：</p>
<img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV03-%E5%BA%94%E7%94%A8%E5%BC%80%E5%8F%91/LV17-01-%E8%BE%93%E5%85%A5%E7%B1%BB%E8%AE%BE%E5%A4%87-03-%E8%A7%A6%E6%91%B8%E5%B1%8F%E8%AE%BE%E5%A4%87/img/image-20240922094313045.png" alt="image-20240922094313045" style="zoom:50%;" />

<p>其中这个goodix-ts就是我所使用的触摸屏的名称。我们使用这个测试程序：</p>
<figure class="highlight c"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">#<span class="keyword">include</span> <span class="string">&lt;stdio.h&gt;</span></span></span><br><span class="line"><span class="meta">#<span class="keyword">include</span> <span class="string">&lt;stdlib.h&gt;</span></span></span><br><span class="line"><span class="meta">#<span class="keyword">include</span> <span class="string">&lt;sys/types.h&gt;</span></span></span><br><span class="line"><span class="meta">#<span class="keyword">include</span> <span class="string">&lt;sys/stat.h&gt;</span></span></span><br><span class="line"><span class="meta">#<span class="keyword">include</span> <span class="string">&lt;fcntl.h&gt;</span></span></span><br><span class="line"><span class="meta">#<span class="keyword">include</span> <span class="string">&lt;unistd.h&gt;</span></span></span><br><span class="line"><span class="meta">#<span class="keyword">include</span> <span class="string">&lt;linux/input.h&gt;</span></span></span><br><span class="line"></span><br><span class="line"><span class="type">int</span> <span class="title function_">main</span><span class="params">(<span class="type">int</span> argc, <span class="type">char</span> *argv[])</span></span><br><span class="line">&#123;</span><br><span class="line">    <span class="class"><span class="keyword">struct</span> <span class="title">input_event</span> <span class="title">in_ev</span> =</span> &#123;&#123;<span class="number">0</span>&#125;&#125;;</span><br><span class="line">    <span class="type">int</span> fd = <span class="number">-1</span>;</span><br><span class="line">    <span class="comment">/* 校验传参 */</span></span><br><span class="line">    <span class="keyword">if</span> (<span class="number">2</span> != argc)</span><br><span class="line">    &#123;</span><br><span class="line">        <span class="built_in">fprintf</span>(<span class="built_in">stderr</span>, <span class="string">&quot;usage: %s &lt;input-dev&gt;\n&quot;</span>, argv[<span class="number">0</span>]);</span><br><span class="line">        <span class="built_in">exit</span>(<span class="number">-1</span>);</span><br><span class="line">    &#125;</span><br><span class="line"></span><br><span class="line">    <span class="comment">/* 打开文件 */</span></span><br><span class="line">    <span class="keyword">if</span> (<span class="number">0</span> &gt; (fd = open(argv[<span class="number">1</span>], O_RDONLY)))</span><br><span class="line">    &#123;</span><br><span class="line">        perror(<span class="string">&quot;open error&quot;</span>);</span><br><span class="line">        <span class="built_in">exit</span>(<span class="number">-1</span>);</span><br><span class="line">    &#125;</span><br><span class="line"></span><br><span class="line">    <span class="keyword">while</span>(<span class="number">1</span>)</span><br><span class="line">    &#123;</span><br><span class="line"></span><br><span class="line">        <span class="comment">/* 循环读取数据 */</span></span><br><span class="line">        <span class="keyword">if</span> (<span class="keyword">sizeof</span>(<span class="keyword">struct</span> input_event) != read(fd, &amp;in_ev, <span class="keyword">sizeof</span>(<span class="keyword">struct</span> input_event)))</span><br><span class="line">        &#123;</span><br><span class="line">            perror(<span class="string">&quot;read error&quot;</span>);</span><br><span class="line">            <span class="built_in">exit</span>(<span class="number">-1</span>);</span><br><span class="line">        &#125;</span><br><span class="line"></span><br><span class="line">        <span class="built_in">printf</span>(<span class="string">&quot;type:%d code:%d value:%d\n&quot;</span>,</span><br><span class="line">               in_ev.type, in_ev.code, in_ev.value);</span><br><span class="line">    &#125;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>

<p>编译后执行以下命令：</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">./app_demo /dev/input/event1</span><br></pre></td></tr></table></figure>

<p>然后一个手指点击触摸屏先不松开，终端将会打印如下信息：  </p>
<img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV03-%E5%BA%94%E7%94%A8%E5%BC%80%E5%8F%91/LV17-01-%E8%BE%93%E5%85%A5%E7%B1%BB%E8%AE%BE%E5%A4%87-03-%E8%A7%A6%E6%91%B8%E5%B1%8F%E8%AE%BE%E5%A4%87/img/image-20240922102341563.png" alt="image-20240922102341563" style="zoom:50%;" />

<p>我不知道是不是因为我这个是5点触摸屏的缘故，和正点原子官方提供的文档中的差别还挺大，这里按文档中进行学习吧，毕竟我用的是另一块屏幕。文档中现象是这样的：</p>
<img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV03-%E5%BA%94%E7%94%A8%E5%BC%80%E5%8F%91/LV17-01-%E8%BE%93%E5%85%A5%E7%B1%BB%E8%AE%BE%E5%A4%87-03-%E8%A7%A6%E6%91%B8%E5%B1%8F%E8%AE%BE%E5%A4%87/img/image-20240922102435847.png" alt="image-20240922102435847" />

<p>第一行上报了绝对位移事件 EV_ABS（type&#x3D;3）中的 ABS_MT_TRACKING|_ID（code&#x3D;57）事件，并且 value 值等于 78，也就是 ID，这个 ID 是一个非负数，所以表示这是一个新的触摸点被创建，也就意味着触摸屏上产生了一个新的触摸点（手指按下） 。  </p>
<p>第二行上报了绝对位移事件 EV_ABS（type&#x3D;3）中的 ABS_MT_POSITION_X（code&#x3D;53）事件，其 value对应的便是触摸点的 X 坐标；第三行上报了 ABS_MT_POSITION_Y（code&#x3D;54）事件，其 value 值对应的便是触摸点 Y 坐标，所以由此可知该触摸点的坐标为(372, 381)。  </p>
<p>第四行上报了按键类事件 EV_KEY（type&#x3D;1）中的 BTN_TOUCH（code&#x3D;330） ， value 值等于 1，表示这是触摸屏上最先产生的触摸点（slot&#x3D;0、也就是触摸点 0） 。  </p>
<p>第五行和第六行分别上报了绝对位移事件 EV_ABS（type&#x3D;3）中的 ABS_X（code&#x3D;0）和 ABS_Y（code&#x3D;1），其 value 分别对应的是触摸点的 X 坐标和 Y 坐标。 多点触摸设备也会通过 ABS_X、 ABS_Y 事件上报触摸点的 X、 Y 坐标， 但通常只有触摸点 0 支持，所以可以把多点触摸设备当成单点触摸设备来使用。  </p>
<p>最后一行上报了同步类事件 EV_SYN（type&#x3D;0）中的 SYN_REPORT（code&#x3D;0）事件，表示此次触摸点的信息全部上报完毕。  </p>
<p>在第一个触摸点的基础上，增加第二个触摸点，打印信息如下所示（还是按文档来学习）：</p>
<img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV03-%E5%BA%94%E7%94%A8%E5%BC%80%E5%8F%91/LV17-01-%E8%BE%93%E5%85%A5%E7%B1%BB%E8%AE%BE%E5%A4%87-03-%E8%A7%A6%E6%91%B8%E5%B1%8F%E8%AE%BE%E5%A4%87/img/image-20240922103226855.png" alt="image-20240922103226855" />

<p>1-7 行和上面一样；</p>
<p>第八行上报了绝对位移事件 EV_ABS（type&#x3D;3）中的 ABS_MT_SLOT 事件（code&#x3D;47），表示目前要更新 slot&#x3D;1 所关联的触摸点（也就是触摸点 1） 对应的信息。  </p>
<p>第九行上报了绝对位移事件 EV_ABS（type&#x3D;3）中的 ABS_MT_TRACKING_ID 事件（code&#x3D;57）， ID&#x3D;79，这是之前没有出现过的 ID，表示这是一个新的触摸点。  </p>
<p>第十、十一行分别上报了 ABS_MT_POSITION_X 和 ABS_MT_POSITION_Y 事件。</p>
<p>最后一行上报同步事件（type&#x3D;0、 code&#x3D;0） ，告知应用层数据完整。</p>
<p>当手指松开时，触摸点就会被销毁，上报 ABS_MT_TRACKING_ID 事件，并将 value 设置为-1（ID），如下所示：    </p>
<img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV03-%E5%BA%94%E7%94%A8%E5%BC%80%E5%8F%91/LV17-01-%E8%BE%93%E5%85%A5%E7%B1%BB%E8%AE%BE%E5%A4%87-03-%E8%A7%A6%E6%91%B8%E5%B1%8F%E8%AE%BE%E5%A4%87/img/image-20240922103702265.png" alt="image-20240922103702265" />

<p>不管是键盘也好、或者是鼠标、触摸屏，都可以像上面那样将输入设备的数据直接打印出来，然后再去分析，确定该输入设备上报事件的规则和流程，把这些弄懂之后再去编写程序验证结果。</p>
<h1 id="四、获取触摸屏信息"><a href="#四、获取触摸屏信息" class="headerlink" title="四、获取触摸屏信息"></a><font size=3>四、获取触摸屏信息</font></h1><p>我们怎么知道这个触摸屏支持几个点？触摸点的坐标在什么范围内？我们其实可以通过 ioctl()函数可以获取到这些信息  </p>
<h2 id="1-函数简介"><a href="#1-函数简介" class="headerlink" title="1. 函数简介"></a><font size=3>1. 函数简介</font></h2><p>ioctl()是一个文件 I&#x2F;O 操作的杂物箱，可以处理的事情非常杂、不统一，一般用于操作特殊文件或设备文件，函数的原型如下：</p>
<figure class="highlight c"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">#<span class="keyword">include</span> <span class="string">&lt;sys/ioctl.h&gt;</span></span></span><br><span class="line"><span class="type">int</span> <span class="title function_">ioctl</span><span class="params">(<span class="type">int</span> fd, <span class="type">unsigned</span> <span class="type">long</span> request, ...)</span>;</span><br></pre></td></tr></table></figure>

<p>第一个参数 fd 对应文件描述符；</p>
<p>第二个参数 request 与具体要操作的对象有关，没有统一值， 表示向文件描述符请求相应的操作，也就是请求指令；此函数是一个可变参函数， 第三个参数需要根据 request 参数来决定，配合 request 来使用。  </p>
<h2 id="2-如何使用？"><a href="#2-如何使用？" class="headerlink" title="2. 如何使用？"></a><font size=3>2. 如何使用？</font></h2><p>在 <a target="_blank" rel="noopener" href="https://elixir.bootlin.com/linux/v4.15/source/include/uapi/linux/input.h">input.h</a> 头文件有这样一些宏定义，如下所示 ：</p>
<figure class="highlight c"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br><span class="line">53</span><br><span class="line">54</span><br><span class="line">55</span><br><span class="line">56</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">#<span class="keyword">define</span> EVIOCGVERSION		_IOR(<span class="string">&#x27;E&#x27;</span>, 0x01, int)			<span class="comment">/* get driver version */</span></span></span><br><span class="line"><span class="meta">#<span class="keyword">define</span> EVIOCGID		_IOR(<span class="string">&#x27;E&#x27;</span>, 0x02, struct input_id)	<span class="comment">/* get device ID */</span></span></span><br><span class="line"><span class="meta">#<span class="keyword">define</span> EVIOCGREP		_IOR(<span class="string">&#x27;E&#x27;</span>, 0x03, unsigned int[2])	<span class="comment">/* get repeat settings */</span></span></span><br><span class="line"><span class="meta">#<span class="keyword">define</span> EVIOCSREP		_IOW(<span class="string">&#x27;E&#x27;</span>, 0x03, unsigned int[2])	<span class="comment">/* set repeat settings */</span></span></span><br><span class="line"></span><br><span class="line"><span class="meta">#<span class="keyword">define</span> EVIOCGKEYCODE		_IOR(<span class="string">&#x27;E&#x27;</span>, 0x04, unsigned int[2])        <span class="comment">/* get keycode */</span></span></span><br><span class="line"><span class="meta">#<span class="keyword">define</span> EVIOCGKEYCODE_V2	_IOR(<span class="string">&#x27;E&#x27;</span>, 0x04, struct input_keymap_entry)</span></span><br><span class="line"><span class="meta">#<span class="keyword">define</span> EVIOCSKEYCODE		_IOW(<span class="string">&#x27;E&#x27;</span>, 0x04, unsigned int[2])        <span class="comment">/* set keycode */</span></span></span><br><span class="line"><span class="meta">#<span class="keyword">define</span> EVIOCSKEYCODE_V2	_IOW(<span class="string">&#x27;E&#x27;</span>, 0x04, struct input_keymap_entry)</span></span><br><span class="line"></span><br><span class="line"><span class="meta">#<span class="keyword">define</span> EVIOCGNAME(len)		_IOC(_IOC_READ, <span class="string">&#x27;E&#x27;</span>, 0x06, len)		<span class="comment">/* get device name */</span></span></span><br><span class="line"><span class="meta">#<span class="keyword">define</span> EVIOCGPHYS(len)		_IOC(_IOC_READ, <span class="string">&#x27;E&#x27;</span>, 0x07, len)		<span class="comment">/* get physical location */</span></span></span><br><span class="line"><span class="meta">#<span class="keyword">define</span> EVIOCGUNIQ(len)		_IOC(_IOC_READ, <span class="string">&#x27;E&#x27;</span>, 0x08, len)		<span class="comment">/* get unique identifier */</span></span></span><br><span class="line"><span class="meta">#<span class="keyword">define</span> EVIOCGPROP(len)		_IOC(_IOC_READ, <span class="string">&#x27;E&#x27;</span>, 0x09, len)		<span class="comment">/* get device properties */</span></span></span><br><span class="line"></span><br><span class="line"><span class="comment">/**</span></span><br><span class="line"><span class="comment"> * EVIOCGMTSLOTS(len) - get MT slot values</span></span><br><span class="line"><span class="comment"> * @len: size of the data buffer in bytes</span></span><br><span class="line"><span class="comment"> *</span></span><br><span class="line"><span class="comment"> * The ioctl buffer argument should be binary equivalent to</span></span><br><span class="line"><span class="comment"> *</span></span><br><span class="line"><span class="comment"> * struct input_mt_request_layout &#123;</span></span><br><span class="line"><span class="comment"> *	__u32 code;</span></span><br><span class="line"><span class="comment"> *	__s32 values[num_slots];</span></span><br><span class="line"><span class="comment"> * &#125;;</span></span><br><span class="line"><span class="comment"> *</span></span><br><span class="line"><span class="comment"> * where num_slots is the (arbitrary) number of MT slots to extract.</span></span><br><span class="line"><span class="comment"> *</span></span><br><span class="line"><span class="comment"> * The ioctl size argument (len) is the size of the buffer, which</span></span><br><span class="line"><span class="comment"> * should satisfy len = (num_slots + 1) * sizeof(__s32).  If len is</span></span><br><span class="line"><span class="comment"> * too small to fit all available slots, the first num_slots are</span></span><br><span class="line"><span class="comment"> * returned.</span></span><br><span class="line"><span class="comment"> *</span></span><br><span class="line"><span class="comment"> * Before the call, code is set to the wanted ABS_MT event type. On</span></span><br><span class="line"><span class="comment"> * return, values[] is filled with the slot values for the specified</span></span><br><span class="line"><span class="comment"> * ABS_MT code.</span></span><br><span class="line"><span class="comment"> *</span></span><br><span class="line"><span class="comment"> * If the request code is not an ABS_MT value, -EINVAL is returned.</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"><span class="meta">#<span class="keyword">define</span> EVIOCGMTSLOTS(len)	_IOC(_IOC_READ, <span class="string">&#x27;E&#x27;</span>, 0x0a, len)</span></span><br><span class="line"></span><br><span class="line"><span class="meta">#<span class="keyword">define</span> EVIOCGKEY(len)		_IOC(_IOC_READ, <span class="string">&#x27;E&#x27;</span>, 0x18, len)		<span class="comment">/* get global key state */</span></span></span><br><span class="line"><span class="meta">#<span class="keyword">define</span> EVIOCGLED(len)		_IOC(_IOC_READ, <span class="string">&#x27;E&#x27;</span>, 0x19, len)		<span class="comment">/* get all LEDs */</span></span></span><br><span class="line"><span class="meta">#<span class="keyword">define</span> EVIOCGSND(len)		_IOC(_IOC_READ, <span class="string">&#x27;E&#x27;</span>, 0x1a, len)		<span class="comment">/* get all sounds status */</span></span></span><br><span class="line"><span class="meta">#<span class="keyword">define</span> EVIOCGSW(len)		_IOC(_IOC_READ, <span class="string">&#x27;E&#x27;</span>, 0x1b, len)		<span class="comment">/* get all switch states */</span></span></span><br><span class="line"></span><br><span class="line"><span class="meta">#<span class="keyword">define</span> EVIOCGBIT(ev,len)	_IOC(_IOC_READ, <span class="string">&#x27;E&#x27;</span>, 0x20 + (ev), len)	<span class="comment">/* get event bits */</span></span></span><br><span class="line"><span class="meta">#<span class="keyword">define</span> EVIOCGABS(abs)		_IOR(<span class="string">&#x27;E&#x27;</span>, 0x40 + (abs), struct input_absinfo)	<span class="comment">/* get abs value/limits */</span></span></span><br><span class="line"><span class="meta">#<span class="keyword">define</span> EVIOCSABS(abs)		_IOW(<span class="string">&#x27;E&#x27;</span>, 0xc0 + (abs), struct input_absinfo)	<span class="comment">/* set abs value/limits */</span></span></span><br><span class="line"></span><br><span class="line"><span class="meta">#<span class="keyword">define</span> EVIOCSFF		_IOW(<span class="string">&#x27;E&#x27;</span>, 0x80, struct ff_effect)	<span class="comment">/* send a force effect to a force feedback device */</span></span></span><br><span class="line"><span class="meta">#<span class="keyword">define</span> EVIOCRMFF		_IOW(<span class="string">&#x27;E&#x27;</span>, 0x81, int)			<span class="comment">/* Erase a force effect */</span></span></span><br><span class="line"><span class="meta">#<span class="keyword">define</span> EVIOCGEFFECTS		_IOR(<span class="string">&#x27;E&#x27;</span>, 0x84, int)			<span class="comment">/* Report number of effects playable at the same time */</span></span></span><br><span class="line"></span><br><span class="line"><span class="meta">#<span class="keyword">define</span> EVIOCGRAB		_IOW(<span class="string">&#x27;E&#x27;</span>, 0x90, int)			<span class="comment">/* Grab/Release device */</span></span></span><br><span class="line"><span class="meta">#<span class="keyword">define</span> EVIOCREVOKE		_IOW(<span class="string">&#x27;E&#x27;</span>, 0x91, int)			<span class="comment">/* Revoke device access */</span></span></span><br></pre></td></tr></table></figure>

<p>每一个宏定义后面都有相应的注释，对于 input 输入设备，对其执行 ioctl()操作需要使用这些宏， 不同的宏表示不同请求指令； 如使用 EVIOCGNAME 宏获取设备名称，使用方式如下：  </p>
<figure class="highlight c"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line"><span class="type">char</span> name[<span class="number">100</span>];</span><br><span class="line">ioctl(fd, EVIOCGNAME(<span class="keyword">sizeof</span>(name)), name);</span><br></pre></td></tr></table></figure>

<p>EVIOCGNAME(len)就表示用于接收字符串数据的缓冲区大小，而此时 ioctl()函数的第三个参数需要传入一个缓冲区的地址，该缓冲区用于存放设备名称对应的字符串数据。  </p>
<p>EVIOCG（get）开头的表示获取信息， EVIOCS（set）开头表示设置；这里暂且不管其它宏，重点来看看 EVIOCGABS(abs)宏， 这个宏也是通常使用最多的， 如下所示：</p>
<figure class="highlight c"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">#<span class="keyword">define</span> EVIOCGABS(abs) _IOR(<span class="string">&#x27;E&#x27;</span>, 0x40 + (abs), struct input_absinfo)</span></span><br></pre></td></tr></table></figure>

<p>通过这个宏可以获取到触摸屏 slot（slot&lt;0&gt;表示触摸点 0、 slot&lt;1&gt;表示触摸点 1、 slot&lt;2&gt;表示触摸点 2，以此类推）的取值范围， 可以看到使用该宏需要传入一个 abs 参数，该参数表示为一个 ABS_XXX 绝对位移事件，如 EVIOCGABS(ABS_MT_SLOT)表示获取触摸屏的 slot 信息，此时 ioctl()函数的第三个参数是一个 struct input_absinfo *的指针，指向一个 struct input_absinfo 对象，调用 ioctl()会将获取到的信息写入到struct input_absinfo 对象中。 struct input_absinfo 结构体（<a target="_blank" rel="noopener" href="https://elixir.bootlin.com/linux/v4.15/source/include/uapi/linux/input.h#L74">input.h - include&#x2F;uapi&#x2F;linux&#x2F;input.h - Linux source code v4.15 - Bootlin</a>）如下所示：  </p>
<figure class="highlight c"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br></pre></td><td class="code"><pre><span class="line"><span class="class"><span class="keyword">struct</span> <span class="title">input_absinfo</span> &#123;</span></span><br><span class="line">    __s32 value; <span class="comment">//最新的报告值</span></span><br><span class="line">    __s32 minimum; <span class="comment">//最小值</span></span><br><span class="line">    __s32 maximum; <span class="comment">//最大值</span></span><br><span class="line">    __s32 fuzz;</span><br><span class="line">    __s32 flat;</span><br><span class="line">    __s32 resolution;</span><br><span class="line">&#125;;</span><br></pre></td></tr></table></figure>

<p>获取触摸屏支持的最大触摸点数：  </p>
<figure class="highlight c"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br></pre></td><td class="code"><pre><span class="line"><span class="class"><span class="keyword">struct</span> <span class="title">input_absinfo</span> <span class="title">info</span>;</span></span><br><span class="line"><span class="type">int</span> max_slots; <span class="comment">// 最大触摸点数</span></span><br><span class="line"><span class="keyword">if</span> (<span class="number">0</span> &gt; ioctl(fd, EVIOCGABS(ABS_MT_SLOT), &amp;info))</span><br><span class="line">&#123;</span><br><span class="line">	perror(<span class="string">&quot;ioctl error&quot;</span>);</span><br><span class="line">&#125;</span><br><span class="line">max_slots = info.maximum + <span class="number">1</span> - info.minimum;</span><br></pre></td></tr></table></figure>

<h1 id="五、查看触摸屏节点"><a href="#五、查看触摸屏节点" class="headerlink" title="五、查看触摸屏节点"></a><font size=3>五、查看触摸屏节点</font></h1><p>其实前面已经说过了，我们还是通过以下命令来查看：</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">cat /proc/bus/input/devices</span><br></pre></td></tr></table></figure>

<p>可以看到如下打印信息：</p>
<img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV03-%E5%BA%94%E7%94%A8%E5%BC%80%E5%8F%91/LV17-01-%E8%BE%93%E5%85%A5%E7%B1%BB%E8%AE%BE%E5%A4%87-03-%E8%A7%A6%E6%91%B8%E5%B1%8F%E8%AE%BE%E5%A4%87/img/image-20240922094313045.png" alt="image-20240922094313045" style="zoom:50%;" />

<p>其中这个goodix-ts就是我所使用的触摸屏的名称。</p>

    </div>

    
    
    

    <footer class="post-footer">




    <div>
        
            <div style="text-align:center;color: #ccc;font-size:14px;">
            ----------本文结束
            <i class="fas fa-fan fa-spin" style="color: #FF1493; font-size: 1rem"></i>
            感谢您的阅读----------
            </div>
        
    </div>





  
  <div class="my_post_copyright"> 
    <p><span>文章标题:</span><a href="/post/b62103be.html">LV17-01-输入类设备-03-触摸屏设备</a></p>
    <p><span>文章作者:</span><a href="/" title="欢迎访问 《苏木》 的学习笔记">苏木</a></p>
    <p><span>发布时间:</span>2024年10月27日 - 19:29</p>
    <p><span>最后更新:</span>2025年06月14日 - 00:25</p>
    <p><span>原始链接:</span><a href="/post/b62103be.html" title="LV17-01-输入类设备-03-触摸屏设备">https://sumumm.github.io/post/b62103be.html</a></p>
    <p><span>许可协议:</span><i class="fab fa-creative-commons"></i> <a rel="license" href= "https://creativecommons.org/licenses/by-nc-nd/4.0/" target="_blank" title="Attribution-NonCommercial-NoDerivatives 4.0 International (CC BY-NC-ND 4.0)">署名-非商业性使用-禁止演绎 4.0 国际</a> 转载请保留原文链接及作者。</p>  
  </div>
  


          <div class="post-tags">
              <a href="/tags/ALPHA-LV03-%E5%BA%94%E7%94%A8%E5%BC%80%E5%8F%91/" rel="tag"><i class="fa fa-tag"></i> (ALPHA)LV03-应用开发</a>
          </div>

        

          <div class="post-nav">
            <div class="post-nav-item">
                <a href="/post/5f2e0a69.html" rel="prev" title="LV17-01-输入类设备-04-触摸屏应用开发实例">
                  <i class="fa fa-angle-left"></i> LV17-01-输入类设备-04-触摸屏应用开发实例
                </a>
            </div>
            <div class="post-nav-item">
                <a href="/post/e3e38c1.html" rel="next" title="LV17-01-输入类设备-02-按键应用开发实例">
                  LV17-01-输入类设备-02-按键应用开发实例 <i class="fa fa-angle-right"></i>
                </a>
            </div>
          </div>
    </footer>
  </article>
</div>






</div>
  </main>

  <footer class="footer">
    <div class="footer-inner">

  <div class="copyright">
    &copy; 2017 – 
    <span itemprop="copyrightYear">2025</span>
    <span class="with-love">
      <i class="fa fa-heart"></i>
    </span>
    <span class="author" itemprop="copyrightHolder">苏木</span>
  </div>
<div class="wordcount">
  <span class="post-meta-item">
    <span class="post-meta-item-icon">
      <i class="fa fa-chart-line"></i>
    </span>
      <span>站点总字数：</span>
    <span title="站点总字数">3.7m</span>
  </span>
  <span class="post-meta-item">
    <span class="post-meta-item-icon">
      <i class="fa fa-coffee"></i>
    </span>
      <span>站点阅读时长 &asymp;</span>
    <span title="站点阅读时长">225:26</span>
  </span>
</div>




    <span id="sitetime"></span>
    <script defer language=javascript>
        function siteTime()
        {
            window.setTimeout("siteTime()", 1000);
            var seconds = 1000;
            var minutes = seconds * 60;
            var hours = minutes * 60;
            var days = hours * 24;
            var years = days * 365;
            var today = new Date();
            var todayYear = today.getFullYear();
            var todayMonth = today.getMonth()+1;
            var todayDate = today.getDate();
            var todayHour = today.getHours();
            var todayMinute = today.getMinutes();
            var todaySecond = today.getSeconds();
            /*==================================================
            Date.UTC() -- 返回date对象距世界标准时间(UTC)1970年1月1日午夜之间的毫秒数(时间戳)
            year        - 作为date对象的年份，为4位年份值
            month       - 0-11之间的整数，做为date对象的月份
            day         - 1-31之间的整数，做为date对象的天数
            hours       - 0(午夜24点)-23之间的整数，做为date对象的小时数
            minutes     - 0-59之间的整数，做为date对象的分钟数
            seconds     - 0-59之间的整数，做为date对象的秒数
            microseconds - 0-999之间的整数，做为date对象的毫秒数
            ==================================================*/
            var t1 = Date.UTC(2017, 
                              5, 
                              19, 
                              0, 
                              0, 
                              0); //北京时间
            var t2 = Date.UTC(todayYear,todayMonth,todayDate,todayHour,todayMinute,todaySecond);
            var diff = t2-t1;
            var diffYears = Math.floor(diff/years);
            var diffDays = Math.floor((diff/days)-diffYears*365);
            var diffHours = Math.floor((diff-(diffYears*365+diffDays)*days)/hours);
            var diffMinutes = Math.floor((diff-(diffYears*365+diffDays)*days-diffHours*hours)/minutes);
            var diffSeconds = Math.floor((diff-(diffYears*365+diffDays)*days-diffHours*hours-diffMinutes*minutes)/seconds);
            document.getElementById("sitetime").innerHTML="已在这里 "+diffYears+" 年 "+diffDays+" 天 "+diffHours+" 小时 "+diffMinutes+" 分钟 "+diffSeconds+" 秒";
        }
        siteTime();
    </script>



    </div>
  </footer>

  
  <div class="back-to-top" role="button" aria-label="返回顶部">
    <i class="fa fa-arrow-up fa-lg"></i>
    <span>0%</span>
  </div>
  <div class="reading-progress-bar"></div>

<noscript>
  <div class="noscript-warning">Theme NexT works best with JavaScript enabled</div>
</noscript>


  
  <script src="https://cdnjs.cloudflare.com/ajax/libs/animejs/3.2.1/anime.min.js" integrity="sha256-XL2inqUJaslATFnHdJOi9GfQ60on8Wx1C2H8DYiN1xY=" crossorigin="anonymous"></script>
  <script src="https://cdnjs.cloudflare.com/ajax/libs/next-theme-pjax/0.6.0/pjax.min.js" integrity="sha256-vxLn1tSKWD4dqbMRyv940UYw4sXgMtYcK6reefzZrao=" crossorigin="anonymous"></script>
  <script src="https://cdnjs.cloudflare.com/ajax/libs/fancyapps-ui/5.0.28/fancybox/fancybox.umd.js" integrity="sha256-ytMJGN3toR+a84u7g7NuHm91VIR06Q41kMWDr2pq7Zo=" crossorigin="anonymous"></script>
  <script src="https://cdnjs.cloudflare.com/ajax/libs/lozad.js/1.16.0/lozad.min.js" integrity="sha256-mOFREFhqmHeQbXpK2lp4nA3qooVgACfh88fpJftLBbc=" crossorigin="anonymous"></script>
<script src="/js/comments.js"></script><script src="/js/utils.js"></script><script src="/js/motion.js"></script><script src="/js/next-boot.js"></script><script src="/js/pjax.js"></script>

  <script src="https://cdnjs.cloudflare.com/ajax/libs/hexo-generator-searchdb/1.4.1/search.js" integrity="sha256-1kfA5uHPf65M5cphT2dvymhkuyHPQp5A53EGZOnOLmc=" crossorigin="anonymous"></script>
<script src="/js/third-party/search/local-search.js"></script>




  <script src="/js/third-party/fancybox.js"></script>

  <script src="/js/third-party/pace.js"></script>


  




  

  <script class="next-config" data-name="enableMath" type="application/json">true</script><script class="next-config" data-name="mathjax" type="application/json">{"enable":true,"tags":"none","js":{"url":"https://cdnjs.cloudflare.com/ajax/libs/mathjax/3.2.2/es5/tex-mml-chtml.js","integrity":"sha256-MASABpB4tYktI2Oitl4t+78w/lyA+D7b/s9GEP0JOGI="}}</script>
<script src="/js/third-party/math/mathjax.js"></script>


 
        <div id="click-show-text"
            data-mobile = false
            data-text = 富强,民主,文明,和谐,自由,平等,公正,法制,爱国,敬业,诚信,友善
            data-fontsize = 15px
            data-random= false>
        </div>
       

      
        <script async src=https://cdn.jsdelivr.net/npm/hexo-next-mouse-effect@latest/click/showText.js></script>
      

      
    




    <script async src="/js/fancybox_param.js"></script>





<!-- APlayer本体 -->



</body>
</html>
